//

//  itcastWeibo
//
//  Created by 谢臣 on 2019/10/21.
//  Copyright © 2019 itcast. All rights reserved.
//

import Foundation
import UIKit
class WBCutomNavigationBar: UINavigationBar {
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
   
        
        if #available(iOS 11.0, *){
            //解决ioss11以后状态栏与导航栏重合的问题
            for subview in self.subviews {
                let stringFromClass = NSStringFromClass(subview.classForCoder)
                
                if stringFromClass.contains("BarBackground") {
                    subview.frame = self.bounds
                } else if stringFromClass.contains("UINavigationBarContentView") {
                    subview.frame = CGRect(x: 0, y: 20, width: UIScreen.cz_screenWidth(), height: 44)
                }
            }
            
        }
       
    }
    
    
    
}
